//
//  AnyGestureViewController.swift
//  testRxSwift
//
//  Created by 火星人 on 2017/7/28.
//  Copyright © 2017年 火星人. All rights reserved.
//

import UIKit
import RxGesture
import RxCocoa
import RxSwift


class AnyGestureViewController: BaseViewController {

    let disposed = DisposeBag()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let tapView = UIView(frame: CGRect(x: 0, y: 80, width: 80, height: 80))
        tapView.backgroundColor = UIColor.randomColor()
        self.view.addSubview(tapView)
        
        tapView.centerInSuperView()
        
        tapView.rx.anyGesture(.tap(), .swipe([.left, .right]))
            .when(.recognized)
            .subscribe { (eve) in
                print(eve)
            }
            .disposed(by: disposed)
        
        
        self.view.rx.anyGesture(
                (.tap(), when: .recognized),
                (.pan(), when: .ended)
            )
            .when(.recognized)
            .subscribe { (eve) in
                print(eve)
            }
            .disposed(by: disposed)
        
        
    }


}
